#include <iostream>
#include <glib-2.0/glib.h>
#include <glib-2.0/glib/gtypes.h>
#include <glib-2.0/glib/goption.h>
#include "gstreamer_1.h"
#include "gstreamer_2.h"
#include "gstreamer_3.h"
#include "gstreamer_4.h"
#include "gstreamer_5.h"
#include "gstreamer_6.h"
#include "gstreamer_7.h"
#include "gstreamer_8.h"
#include "gstreamer_9.h"

static gboolean print_version = FALSE;
static gchar ** cfg_files = NULL;

GOptionEntry entries[] = {
    {"version", 'v', 0, G_OPTION_ARG_NONE, &print_version, "Print software version", NULL},
    {"cfg-file", 'c', 0, G_OPTION_ARG_FILENAME_ARRAY, &cfg_files, "Set the config file", NULL},
    {NULL},
};

int main(int argc, char** argv){
    GOptionContext *ctx = NULL;
    GOptionGroup *grp = NULL;
    GError *error = NULL;

    ctx = g_option_context_new("XboDemo");
    
    grp = g_option_group_new("abc", NULL, NULL, NULL, NULL);
    g_option_group_add_entries(grp, entries);
    
    g_option_context_set_main_group(ctx, grp);
    g_option_context_add_group(ctx, gst_init_get_option_group());

    gboolean ret = g_option_context_parse(ctx, &argc, &argv, &error);
    if(!ret) {
        goto end;
    }

    guint num;
    if(cfg_files) {
        num = g_strv_length(cfg_files);
    }
    
    play_08(argc, argv);

end:
    if(ctx != NULL) {
        g_option_context_free(ctx);
    }

    return 0;
}
